package library.and.xps.com.step.adapter;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.orhanobut.logger.Logger;

import java.util.ArrayList;
import java.util.List;

import library.and.xps.com.step.R;

public class PersonReAdapter extends AbstractRecyclerAdapter {
    List<PersonRankingRes.ListBean> dataset = new ArrayList<>();
    Context context;

    public PersonReAdapter(Context context, RecyclerView recyclerView) {
        super(context, recyclerView);
        this.context = context;
    }

    public void setDataset(List<PersonRankingRes.ListBean> dataset) {
        this.dataset = dataset;
        notifyDataSetChanged();
    }

    @Override
    protected RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType, boolean isItem) {
        View v = LayoutInflater.from(parent.getContext()).inflate(
                R.layout.person_ranking_item, parent, false);
        return new myViewHolder(v);
    }

    @Override
    protected void onBindViewHolder(RecyclerView.ViewHolder holder, int position, boolean isItem) {
        Logger.d(dataset.get(position).toString());
    }

    class myViewHolder  extends RecyclerView.ViewHolder{
        TextView tv_person_ranking, tv_person_name,tv_step;
        ImageView iv_person_header;
        public myViewHolder(View itemView) {
            super(itemView);
            tv_person_name = (TextView) itemView.findViewById(R.id.tv_person_name);
            tv_step = (TextView) itemView.findViewById(R.id.tv_step);
            tv_person_ranking = (TextView) itemView.findViewById(R.id.tv_person_ranking);
            iv_person_header = (ImageView) itemView.findViewById(R.id.iv_person_header);
        }
    }

}
